<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="UTF-8" />
    <title>Action Sheet - Spec</title>
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
    />
    <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
    <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
    <script src="../../../../../scripts/testing/scripts.js"></script>
    <script nomodule src="../../../../../dist/ionic/ionic.js"></script>
    <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
  </head>
  <script type="module">
    import { actionSheetController } from '../../../../dist/ionic/index.esm.js';
    window.actionSheetController = actionSheetController;
  </script>
  <body>
    <ion-app>
      <ion-header>
        <ion-toolbar>
          <ion-title>Action Sheet - Spec</ion-title>
        </ion-toolbar>
      </ion-header>

      <ion-content class="ion-padding">
        <ion-button expand="block" id="spec" onclick="presentSpec()">Spec</ion-button>
      </ion-content>
    </ion-app>

    <script>
      window.addEventListener('ionActionSheetDidDismiss', function (e) {
        console.log('didDismiss', e);
      });

      async function presentSpec() {
        const mode = Ionic.mode;
        const actionSheet = await actionSheetController.create({
          header: 'Open in',
          buttons: [
            {
              text: 'Item 1',
              icon: 'share',
              handler: () => {
                console.log('Share clicked');
              },
            },
            {
              text: 'Item 2',
              icon: 'link',
              handler: () => {
                console.log('Play clicked');
              },
            },
            {
              text: 'Item 3',
              icon: mode === 'md' ? 'create' : null,
              handler: () => {
                console.log('Favorite clicked');
              },
            },
            {
              text: 'Item 4',
              icon: mode === 'md' ? 'trash' : null,
              handler: () => {
                console.log('Cancel clicked');
              },
            },
            {
              text: 'Item 5',
              icon: mode === 'md' ? 'copy' : null,
              handler: () => {
                console.log('Cancel clicked');
              },
            },
          ],
        });
        await actionSheet.present();
      }
    </script>
  </body>
</html>
